<%--
  Created by IntelliJ IDEA.
  User: 20275
  Date: 2023/11/18
  Time: 16:16
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>

<%@include file="/pages/common/head.jsp"%>

<div id="page-wrapper">
    <div class="row">
        <div class="col-lg-12">
            <h1 class="page-header">学生信息管理</h1>
        </div>
    </div>
    <div class="row">
        <div class="col-lg-12">
            <div class="panel panel-default">
                <div class="panel-heading">
                    学生信息管理 >> 调寝审核
                </div>
                <div class="panel-body">

                    <div style=" overflow-x: auto;white-space: nowrap;">
                        <div class="row">

<%--                            <div class="col-lg-4">--%>
<%--                                <div class="input-group">--%>

<%--                                    <input type="text" class="form-control" id="find_title_input" value="${stuNumber}" placeholder="标题">--%>
<%--                                    <span class="input-group-btn">--%>
<%--													<button class="btn btn-default" id="find_title_button" type="button">查找</button>--%>
<%--												</span>--%>
<%--                                </div>--%>
<%--                            </div>--%>
<%--                            <div class="col-lg-4" style="visibility: hidden;"></div>--%>
<%--                            <div class="col-lg-4" style="visibility: hidden;"></div>--%>
                        </div>
                        <br />
                        <table width="100%" class="table table-striped table-bordered table-hover">
                            <thead>
                            <tr>
                                <th>#</th>
                                <th>姓名</th>
                                <th>联系电话</th>
                                <th>原宿舍楼</th>
                                <th>原楼层</th>
                                <th>原宿舍号</th>
                                <th>新宿舍楼</th>
                                <th>新楼层</th>
                                <th>新宿舍号</th>
                                <th>操作</th>
                            </tr>
                            </thead>
                            <tbody>
                                <c:forEach varStatus="i" items="${TransferAuditingInfos}" var="Info">
                                    <tr>
                                        <td>${i.index + 1}</td>
                                        <td style="display: none">${Info.applyOtherChamberId}</td>
                                        <td style="display: none">${Info.applyNewChamberId}</td>
                                        <td style="display: none">${Info.applyChamberStuId}</td>
                                        <td style="display: none">${Info.applyChamberId}</td>

                                        <td>${Info.studentName}</td>
                                        <td>${Info.applyChamberPhone}</td>
                                        <td style="color: orange;">${Info.applyChamberFloor}</td>
                                        <td style="color: orange;">${Info.applyChamberFloorNumber}层</td>
                                        <td style="color: orange;">${Info.applyChamberNumber}</td>
                                        <td style="color: purple;">${Info.newChamberFloorName}</td>
                                        <td style="color: purple;">${Info.applyChamberNewFloorNumber}层</td>
                                        <td style="color: purple;">${Info.newChamberHotelNumber}</td>
                                        <td>
                                            <p>
                                                <button type="button" id="button_success" class="btn btn-success">通过</button>
                                                <button type="button" id="button_danger" class="btn btn-danger">打回</button>
                                            </p>
                                        </td>
                                    </tr>
                                </c:forEach>
                            </tbody>
                        </table>
                    </div>
                </div>
            </div>
        </div>

    </div>

</div>
<c:if test="${message != null}">
    <script>
        alert("${message}")
    </script>

    <% session.removeAttribute("message");%>
</c:if>
<script>
    $(document).ready(function() {
        // 点击 - 通过按钮
        $("#button_success").click(function(){
            var apply_other_id = $(this).closest('tr').find('td:eq(1)').text();
            var new_chamber_id = $(this).closest('tr').find('td:eq(2)').text();
            var stu_id = $(this).closest('tr').find('td:eq(3)').text();
            var old_chamber_id = $(this).closest('tr').find('td:eq(4)').text();
            var result = confirm("确定要 通过 该学生的调寝申请吗");

            if (result) {
                if (result) {
                    location.href = "${pageContext.request.contextPath}"+
                        "/studentManage/successAuditing?apply_other_id="+apply_other_id+"&new_chamber_id="+new_chamber_id+"&stu_id="+stu_id+"&old_chamber_id="+old_chamber_id
                }
            }
        });

        // 点击 - 打回按钮
        $("#button_danger").click(function(){
            var value = $(this).closest('tr').find('td:eq(1)').text();
            var result = confirm("确定要 打回 该学生的调寝申请吗");

            if (result) {
                location.href = "${pageContext.request.contextPath}"+"/studentManage/dangerAuditing?other_chamber_id="+value
            }
        });


    });
</script>

<%@include file="/pages/common/foot.jsp" %>
